import { CTX, IFormController } from '@ibiz-template/runtime';
import { IControl, IDEFormMDCtrl } from '@ibiz/model-core';
import { EditFormController } from '../../../../edit-form';

/**
 * 表单多数据部件项控制器
 *
 * @author chitanda
 * @date 2022-08-03 11:08:20
 * @export
 * @class MDCtrlFormController
 * @extends {FormController<MDCtrlFormModel>}
 */
export class FormMDCtrlItemController
  extends EditFormController
  implements IFormController
{
  constructor(
    model: IControl,
    context: IContext,
    params: IParams,
    ctx: CTX,
    data: IData,
  ) {
    super(model, context, params, ctx);
    this.state.data = data;
    this.state.isSimple = true;
  }

  public async onInit(): Promise<void> {
    await this.initDetailControllers(
      (this.model as IDEFormMDCtrl).deformDetails,
    );
  }
}
